<template>
	<view class="body">
		
		<image class="red-top" src="../../static/images/red-top.png"></image>
		
		<image @click="goRed()" style="width: 496rpx;height: 125rpx;
				position:fixed;bottom: 100rpx;right:20%;" 
		src="../../static/images/go_red_but.png"></image>
	
	   <view class="total">
		  <view style="font-size: 36rpx;">红包资金池</view>
		   <view style="font-size: 86rpx;">{{total}}</view>
	   </view>  
	 
		
		<image @click="close()" class="close" src="../../static/images/icon-arrow_left.png"></image>




	</view>
</template>


<script>
	import { robRedPack,queryRedConfig } from '@/api/activity.js';
	export default {
		data() {
			return {
               total:0
			}
		},
		onLoad() {
		  this.getRedConfig()	
		},
		methods: { 
		goRed(){ 
			robRedPack().then(res => {
				if(res.code == 200){
					uni.showToast({
						title:'恭喜您抢到'+ res.message,
						icon:'none'
					})
				} 
			});
		},
		getRedConfig(){
			queryRedConfig().then(res => {
				this.total = res.data.total
			});
		}, 
		close() {
			uni.navigateBack({
			    delta: 1 // 默认值是1，表示返回的页面层数
			});
		}
		}
	}
</script>

<style lang="scss" scoped>
	
	.body {
		margin: 0;
	  padding: 0;
	height: 100vh;
	  background-image:url('/static/images/red_pack_bg.png'); /* 替换为你的图片路径 */
	  background-position: center center; /* 图片居中 */
	  background-repeat: no-repeat; /* 不重复 */
	  background-attachment: fixed; /* 背景固定，不随内容滚动 */
	  background-size: cover; /* 图片铺满整个背景 */
	}
	.close{
		width: 80rpx;
		height: 80rpx;
		margin-left: 30rpx;
		margin-top: 80rpx;
		padding: 20rpx;
		background-color: #25000029;
		border-radius: 50rpx; 
		
	}
 
	.total{font-size: 120rpx;position: absolute;top: 700rpx;left: 270rpx;
	font-weight: bold;color: #fff;width: 200rpx;margin: 0 auto;
	text-align: center;
	align-items: center; }
 
	//#ifdef APP-PLUS
	.total{font-size: 120rpx;position: absolute;top: 850rpx;left: 270rpx;
	font-weight: bold;color: #fff;width: 200rpx;margin: 0 auto;
	text-align: center;
	align-items: center; }
	//#endif
	
	
	.red-top{width: 612rpx;height: 138rpx;top: 75px;right: 9%;	position:fixed;
 	}
	
 
	 
</style>